package cn.myjava.gupao.mode.singleton;

/**
 * 内部类的执行逻辑
 * Created by RenFu
 * Date: 2019/5/12
 */
public class InnerClass {

    static {
        System.out.println("InnerClass Static 静态块");
    }

    {
        System.out.println("InnerClass 块");
    }

    public InnerClass() {
        System.out.println("InnerClass() 构造函数");
    }

    public static void testStatic() {
        System.out.println("InnerClass testStatic() 静态方法");
    }

    public void doInnerClassTest() {
        System.out.println("InnerClass doInnerClassTest() 方法");
        subInnerClass sub = new subInnerClass();
        sub.doTest2();
    }

    static class subInnerClass {
        private static final String FINAL_DATA_1 = "全局静态常量";

        private final String data1 = "全局变量";

        static {
            System.out.println("subInnerClass Static 静态块");
        }

        {
            System.out.println("subInnerClass 块");
        }

        public subInnerClass() {
            System.out.println("subInnerClass() 构造函数");
        }

        public static void doTest() {
            System.out.println("subInnerClass doTest() 函数");
        }

        public void doTest2() {
            System.out.println("subInnerClass doTest2() 函数");
        }
    }

    public static void main(String[] args) {
//        InnerClass.subInnerClass.doTest();

        InnerClass innerClass = new InnerClass();
        innerClass.doInnerClassTest();
    }

}
